事先從官網下載RPM安裝包,上傳至服務器:
[root@node2 ~]# ls -l mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 root root 545894400 Mar 27 22:31 mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
解壓查看:
[root@node2 ~]# tar xf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
[root@node2 ~]# ls -l mysql-community-*
-rw-r--r-- 1 7155 31415 ?26670472 Dec 16 10:01 mysql-community-client-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ? ?318884 Dec 16 10:01 mysql-community-common-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ? 4122424 Dec 16 10:01 mysql-community-devel-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ?47760004 Dec 16 10:02 mysql-community-embedded-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ?23316972 Dec 16 10:02 mysql-community-embedded-compat-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 132204460 Dec 16 10:02 mysql-community-embedded-devel-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ? 2474780 Dec 16 10:02 mysql-community-libs-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 ? 1264836 Dec 16 10:02 mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 182274360 Dec 16 10:02 mysql-community-server-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 125477564 Dec 16 10:03 mysql-community-test-5.7.37-1.el7.x86_64.rpm
其中:
mysql-community-client 客戶端
mysql-community-devel 開發庫
mysql-community-common 服務端和客戶端的公共文件
mysql-community-embedded 嵌入式
mysql-community-serve 服務端
mysql-community-test 測試組件
mysql-community-libs 共享庫
mysql-community-libs-compat MySQL之前版本的共享兼容庫
安裝:
首先限制mariadb相關軟件包。
[root@node2 ~]# yum remove mariadb-libs -y
# 安裝
[root@node2 ~]# rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm?
?mysql-community-common-5.7.37-1.el7.x86_64.rpm \
?mysql-community-libs-5.7.37-1.el7.x86_64.rpm \
?mysql-community-server-5.7.37-1.el7.x86_64.rpm
設計開機自啟并啟動
[root@node2 ~]# systemctl enable --now mysqld
登陸
[root@node2 ~]# tmp_pwd=`awk '/temporary password/ {print $NF}' /var/log/mysqld.log`
[root@node2 ~]# mysql -uroot -p$tmp_pwd
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.37 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>